import { EntityModel } from '@midwayjs/orm';
import { Column, OneToMany } from 'typeorm';
import { BaseModel } from '../utils/base.model';
import { ConvenientType } from './ConvenientService';
import { TbFlowLine } from './TbFlowLine';
import { TbFlowNode } from './TbFlowNode';

/**
 * 流程表
 */
@EntityModel()
export class TbFlow extends BaseModel {
  @Column({
    comment: '名称',
  })
  name: string;

  @Column({
    comment: '服务类型',
    type: 'enum',
    enum: ConvenientType,
  })
  convenientType: ConvenientType;

  @Column({
    nullable: true,
    comment: '备注',
  })
  remark: string;

  @OneToMany(() => TbFlowLine, line => line.flow, { eager: true })
  lines: TbFlowLine[];

  @OneToMany(() => TbFlowNode, node => node.flow, { eager: true })
  nodes: TbFlowNode[];
}
